﻿using System;
using System.Collections.Generic;
using System.Text;

using System.Collections;

namespace AI.Fuzzy.Library
{

    public class RuleResult
    {
        public String FuzzyVariableName;
        public String FuzzyTermName;
        public double Value;
    }
    public struct Sharp
    {
        public string sharpName;
        public double value;
        public Sharp(string name, double value)
        {
            sharpName = name;
            this.value = value;
        }
        public override string ToString()
        {
            string str = String.Empty;
            str = sharpName + " " + value.ToString();
            return str;
        }
    }

    public class LRSS_SharpResult:IEnumerable<Sharp>
    {
        List<Sharp> result = new List<Sharp>(14);

        public int Count
        {
            get { return result.Count; }
        }
        public void Add(Sharp sharp)
        {
            result.Add(sharp);
        }
        /// <summary>
        /// big to small
        /// </summary>
        public void Sort()
        {
            result.Sort(delegate(Sharp one, Sharp second) { return second.value.CompareTo(one.value); });
        }
        public override string ToString()
        {
            string str = String.Empty;
            foreach (var item in result)
            {
                str += item.ToString() + System.Environment.NewLine;
            }
            return str;
        }

        #region IEnumerable<Sharp> 成员

        public IEnumerator<Sharp> GetEnumerator()
        {
            return result.GetEnumerator();
        }

        #endregion
        public Sharp this[int index]
        {
            get { return result[index]; }
        }

        #region IEnumerable 成员

        IEnumerator IEnumerable.GetEnumerator()
        {
            throw new NotImplementedException();
        }

        #endregion
    }

    /// <summary>
    /// Write the summary for the test class here.
    /// </summary>
    //[TestFixture]
    //public class TestSharpResult
    //{
    //    /// <summary>
    //    /// Write your test story here.
    //    /// </summary>
    //    /// <remarks>
    //    /// - Desired Result:	Test
    //    /// - Coordinator:      Sort
    //    /// - Conditions:       Function
    //    /// </remarks>
    //    [Test]
    //    public void Test_Sort_Function()
    //    {
    //        LRSS_SharpResult sharps = new LRSS_SharpResult();
    //        sharps.Add(new Sharp("Line", 0.88));
    //        sharps.Add(new Sharp("Triangle", 0.73));
    //        sharps.Add(new Sharp("Rectangle", 0.98));
    //        sharps.Add(new Sharp("Circles", 0.05));
    //        sharps.Add(new Sharp("Ellipse", 0.80));
    //        Console.WriteLine(sharps.ToString());
    //        sharps.Sort();
    //        Console.WriteLine(sharps.ToString());
    //    }
    //}

}
